package com.luyue.zagj.activity.base;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.Spinner;

import com.luyue.zagj.BaseActivity;
import com.luyue.zagj.R;
import com.umeng.analytics.MobclickAgent;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class FindPswPro2Activity extends BaseActivity {

    @Bind(R.id.fndPswPro2_cancel_btn)
    Button fndPswPro2CancelBtn;
    @Bind(R.id.fndPswPro2_pswPro_top_rl)
    RelativeLayout fndPswPro2PswProTopRl;
    @Bind(R.id.fndPswPro2_first_sp)
    Spinner fndPswPro2FirstSp;
    @Bind(R.id.fndPswPro2_first_et)
    EditText fndPswPro2FirstEt;
    @Bind(R.id.fndPswPro2_second_sp)
    Spinner fndPswPro2SecondSp;
    @Bind(R.id.fndPswPro2_second_sp_et)
    EditText fndPswPro2SecondSpEt;
    @Bind(R.id.fndPswPro2_next_btn)
    Button fndPswPro2NextBtn;

    private List<String> list;
    private List<String> list2;

    private ArrayAdapter adpter;
    private ArrayAdapter adpter2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_find_psw_pro2);
        ButterKnife.bind(this);

        list = new ArrayList<String>();
        list.add("请选择问题");
        list.add("text1");
        list.add("text2");
        list.add("text3");

        list2 = new ArrayList<String>();
        list2.add("请选择问题");
        list2.add("text1");
        list2.add("text2");
        list2.add("text3");

        adpter = new ArrayAdapter(this, R.layout.spinner_item, R.id.textId, list);
        adpter2 = new ArrayAdapter(this, R.layout.spinner_item, R.id.textId, list2);

        fndPswPro2FirstSp.setAdapter(adpter);
        fndPswPro2FirstSp.setPrompt("选择问题");
        fndPswPro2FirstSp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                String str = parent.getItemAtPosition(position).toString();
                //  Toast.makeText(FindPswPro2Activity.this, "你点击的是:"+str, Toast.LENGTH_SHORT).show();
                //list2.remove(position);
                //adpter2.notifyDataSetChanged();

            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });
        fndPswPro2SecondSp.setAdapter(adpter2);
        fndPswPro2SecondSp.setPrompt("选择问题");
        fndPswPro2SecondSp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                String str = parent.getItemAtPosition(position).toString();

               // Toast.makeText(FindPswPro2Activity.this, "你点击的是:" + str, Toast.LENGTH_SHORT).show();
//                list2.remove(position);
//                adpter2.notifyDataSetChanged();

            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });
    }

    @OnClick({R.id.fndPswPro2_cancel_btn, R.id.fndPswPro2_next_btn})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.fndPswPro2_cancel_btn:
                onBackPressed();
                break;
            case R.id.fndPswPro2_next_btn:
                Intent it = new Intent(this, ResetPswActivity.class);
                startActivity(it);
                finish();
                break;
        }
    }

}
